<%-- 
    Document   : forestshow
    Created on : Nov 25, 2012, 8:05:54 PM
    Author     : ceja
--%>


<%@ page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="http://stripes.sourceforge.net/stripes.tld" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>

<s:useActionBean beanclass="cz.muni.fi.pa165.web.SecurityActionBean" var="securityBean"/>
<f:message key="title.forestlist" var="headline" />
<s:layout-render name="/layout.jsp" headline="${headline}">
	<s:layout-component name="content">
		<s:useActionBean beanclass="cz.muni.fi.pa165.web.ForestsActionBean" var="actionBean"/>


		<table class="listtable">
			<tr>
				<th width="20%"><f:message key="forest.name"/></th>
				<th width="35%"><f:message key="forest.info"/></th>
                                <th width="35%"><f:message key="forest.mushrooms"/></th>
				<th width="5%"></th>
				<th width="5%"></th>
			</tr>
			<c:forEach items="${actionBean.forests}" var="forest" varStatus="status">
				<tr class="${(status.count % 2 == 0 ) ? "even" : "odd"}">
					<td><c:out value="${forest.name}"/></td>
					
					<td><c:out value="${forest.info}"/></td>
                                        <td>
                                            <c:forEach items="${forest.mushrooms}" var="mushroom" varStatus="statusMushroom">
                                                <c:out value="${mushroom.name}"/>
                                                <br />
                                            </c:forEach>
                                        </td>
					<td><s:link beanclass="cz.muni.fi.pa165.web.ForestsActionBean" event="edit"><s:param name="forest.id" value="${forest.id}"/><f:message key="edit"/></s:link> </td>
					<td><s:link addSourcePage="true" beanclass="cz.muni.fi.pa165.web.ForestsActionBean" event="delete" class="deleteentity" title="${forest.name}"><s:param name="forest.id" value="${forest.id}"/><f:message key="delete"/></s:link> </td>
                                </tr>
			</c:forEach>
		</table>
				
		<s:form beanclass="cz.muni.fi.pa165.web.ForestsActionBean">
			<fieldset><legend><f:message key="new"/></legend>
				<%@include file="forestform.jsp"%>
				<s:submit name="add"><f:message key="create"/></s:submit>
				</fieldset>
		</s:form>
				
	</s:layout-component>
</s:layout-render>